package com.entity;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.vladmihalcea.hibernate.type.json.JsonType;
import lombok.*;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 【产业园】-出租管理
 */

@Entity
@Table(name = "rental_info")
@Getter @Setter @NoArgsConstructor
@TypeDef(
        name = "json",
        typeClass = JsonType.class
)
public class BuildingRentalInfo extends BaseEntity {

    private String buildingCode;

    @Type(type = "json")
    @Column(name = "floors")
    private List<Integer> floors;
    @Column(name = "start_date")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startDate;

    @Column(name = "end_date")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endDate;

    @Column(name = "rent", precision = 12, scale = 2, columnDefinition = "DECIMAL(15,2) default 0")
    private BigDecimal rent = BigDecimal.ZERO;

    @Column(name = "rent_name")
    private String rentName;

    @Column(name = "remark", length = 500)
    private String remark;
}